#!/bin/bash
#https://www.cnblogs.com/openxxs/p/4655612.html
#docker run --name='bind' -d -p 53:53/udp -e WEBMIN_ENABLED=false -v /opt/scs/openxxs/bind:/data sameersbn/bind:latest

sudo mkdir -p /opt/dnsbind
sudo chmod 777 -R /opt/dnsbind

#https://github.com/sameersbn/docker-bind/releases
docker ps -a | grep 'bind'
if [ $? -eq 0 ]; then
 echo "start bind container"
 docker start bind
else
 echo "start bind image"
 docker run --name bind -d \
  --publish 53:53/tcp --publish 53:53/udp --publish 10000:10000/tcp \
  --volume /opt/dnsbind:/data \
  sameersbn/bind

#web系统不启动的模式
  #docker run --name bind -d -e WEBMIN_ENABLED=false \
  #--publish 53:53/tcp --publish 53:53/udp --publish 10000:10000/tcp \
  #--volume /opt/dnsbind:/data \
  #sameersbn/bind
fi
# https://localhost:10000/ webmin

sudo cp -f conf/* /opt/dnsbind/bind/etc/.
